//
//  FeedbackViewController.m
//  BOSS-SOOC
//
//  Created by apple on 16/8/23.
//  Copyright © 2016年 Gcx. All rights reserved.
//

#import "FeedbackViewController.h"
#import "SCSegmentScrollView.h"
#import "commitOption/SCCommitView.h"
#import "OptionTableView.h"
#import "FeadbackDetailViewController.h"

static CGFloat _seg_height = 48;

@interface FeedbackViewController()<OptionTableViewDelegate>

@property (nonatomic,strong) OptionTableView *tbale;


@end

@implementation FeedbackViewController

-(void)viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:animated];
    
    [_tbale loadDataOfNone];

}

- (void)viewDidLoad{

    [super viewDidLoad];
    
    [self setNavBarTitle:@"意见反馈"];

    self.automaticallyAdjustsScrollViewInsets=NO;
    
    NSMutableArray *array=[NSMutableArray array];

    SCCommitView *view=[[SCCommitView alloc] init];

    [array addObject:view];

    _tbale=[[OptionTableView alloc] init];
    _tbale.sc_delegate = self;
    
    [array addObject:_tbale];
    
    SCSegmentScrollView *scView=[[SCSegmentScrollView alloc] initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, self.view.bounds.size.height-64) titleArray:@[@"提交反馈",@"我的反馈"] contentViewArray:array];
    [self.view addSubview:scView];

}

- (void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
    
    [_tbale reset];
}
#pragma mark TableView SC_Delegate
/**
 *  选中了某条数据
 *
 *  @param tableView self
 *  @param model     关联的数据
 */
-(void)tableView:(OptionTableView *)tableView didSelectModel:(OptionModel *)model{
    
    FeadbackDetailViewController *detail = [[FeadbackDetailViewController alloc]initDataOptionModel:model];
    
    detail.hidesBottomBarWhenPushed = YES;
    
    [self navigationCanDragBack:YES];
    
    [self.navigationController pushViewController:detail animated:YES];
    
    NSLog(@"model.uid == %@", model.ztnr);
    
}

@end
